package com.woniu.cq.medical.service.impl;

import com.woniu.cq.medical.dao.mymapper.My_MedicineMapper;
import com.woniu.cq.medical.entity.Medicine;
import com.woniu.cq.medical.dao.MedicineMapper;
import com.woniu.cq.medical.service.MedicineService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Lucas
 * @since 2020-09-05
 */
@Service
public class MedicineServiceImpl extends ServiceImpl<MedicineMapper, Medicine> implements MedicineService {
    @Autowired
    private My_MedicineMapper myMedicineMapper;

    /**
     * 根据药名模糊查询药品
     * @param MedicineName
     * @return 药品的集合
     */
    @Override
    public List<Medicine> selectMedicineLikeName(String MedicineName) {
        List<Medicine> medicines = myMedicineMapper.selectMedicineLikeName(MedicineName);
        return medicines;
    }

    /**
     * 根据药品名字和规格找出对应的药品
     * @param MedicineName
     * @param ProductFormat
     * @return
     */
    @Override
    public Medicine selectMedicineLikeNameAndProductFormat(String MedicineName, String ProductFormat) {
        Medicine medicine = myMedicineMapper.selectMedicineLikeNameAndProductFormat(MedicineName, ProductFormat);
        return medicine;
    }
}
